package com.tender.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;

@Data
@RefreshScope
@ConfigurationProperties(prefix = "app.config")
public class AppConfigProperties {

    /**
     * 发送验证码剩余次数（默认5次）
     * TODO 上线前，修改回来
     */
    private int smsLeftNum = 5;

    /**
     * 发送短信剩余次数过期时间 s（默认一天）
     */
    private int smsLeftNumExpire = 24 * 60 * 60;

    /**
     * 短信验证码失效时间（默认60s）
     */
    private int verifyCodeExpireTimes = 60;

    /**
     * 图片验证码失效时间（默认300s）
     */
    private int picCodeExpireTimes = 300;

    /**
     * refreshToken 失效时间（默认 3 天） ，单位 min
     */
    private int refreshTokenExpireTimes = 3 * 24 * 60;

    /**
     * 短信验证码的长度(默认6)
     */
    private int phoCodeNum = 6;

    /**
     * 处理验证码的方式（默认是 SMS）
     * 1、SMS
     * 2、EMAIL
     * 3、DING
     */
    private String verifyCodeActivation = "SMS";

    /**
     * 验证码并发处理所需等待的最大时间 （默认2min）
     */
    private int waitMinute = 2;

    /**
     * 公钥字符串
     */
    private String publicKeyStr = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlfA4Ed+iPmX3UeVcG1Uqjgl5wsASN669NSyO0Jrf0FauC8rjM4jQlqSZFROTb2tlMLFiVNJPTCOhrqGTf1TzubsoU8lprm000G8Xg4YPRO3zmMaDgyKmWcjWydoE4uBRlf7K4+12Dlw/gTaCZDdVNpdyaTSZ1tu2dyCGWOICpbXlIA9hdkam6JDU0hsjaHoMcLC61w+IzQTIJlUHh5BJE/jao9Qr8AV9gYW0+3BtT9Pu38kc/mA5rjxapAxnhfOKSfy9V0ipBsvdNuA6zDgdo2slLj/EwQogtG48U2Q/4pIN89/61DKdqCfHfAi6DBQBwAOnNcyRaA/IXH7BVHc0FwIDAQAB";

    /**
     * 私钥字符串
     */
    private String privateKeyStr = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEA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h9qjci+csEMjy9S/xlkC3RtNIkXqAyPxCGc+SGsejclFj8OIUs0CS1k7rhKlZHDKoH29m2wVq83Qv6174P1sg0a7vm15ukPkchJNpe6hhi3lzYw2GgVOEeTkLXol7vZFr4twytValfLuArm9wchAoGADHqGQH7dNK2Y1+Y0HLPWmwj/p2zJ9dkccu6ji5T+bbV3NUWk1mds8+OqJ3SRFRmuDq4Vhh3/FvBtChSir6IrOBr/1mrbetSh5Q5JIchbYwy0J8yc2PyCs72RjKJykvYWpO9cNnn09+CsD50iaT/100Y30kDVjhMHC0a0c+aDOM0CgYBmI0cp3ecCGSl6VSrOL8yJ1KYwQXKYkaQ7qxA5VFHS7q/OZzYswNAYr6bcwvUK4igK38q3ISy+iG/LfV6U5xqwiLjsr8rpz7r6i0RX1602fFYS3JtNdkd0QMSRc6YAL05lQZPjbvcSmuUZjaZt3zOMXTo/mayggbHgIlV/xlVjHw==";

    /**
     * AES secret (被 RAS 公钥加密后如下：)
     */
    private String secretAES128 = "a7hSw4kwlwqPlLOrvexd5w9kaq0OolYyjf+vsi3GLtn3U48y/7jjrR1PFbplGP4/4SN7lCH1JlmVkBJFo/VZEK0DF5o1joGymlYq0V0KxitetlTdrWlsJ48toQjkcFE4EG05U6wrRjStJcjqd5DeM5CuKQiawqHuenzSnrZAmLC4+PEDSp6CtCfp6PQnYW4+TqObOb+yhSxQHO5h+xI9QzzwKd/CtSP+m8HlDNVryBFSC/xVMgBbrFzXiOlwsVCdjA+a7tUk3HwT6uFrx+ApuGhdbs+NKjG/FfCs4KEk1AG+/DWt2REBmyqf/ZJnTBxSosb+LXh6jfSAb4JdcjuWKQ==";

    /**
     * AES 密钥原始内容
     */
    private String keyAES128 = "o2OswWMuB1Xp+39YGlFltA==";

    /**
     * 是否是测试环境，用于明文传递 keyAES128
     */
    private boolean devEnv = true;

    /**
     * iv 偏移量 （被 base64 编码过）
     */
    private String ivAES = "Cezx1RgL2Q96ThoIp3cnog==";

    /**
     * 是否使用 iv 偏移量
     */
    private boolean useIvAES = false;

    /**
     * 允许参数最大的过期时间 gap 为 1min
     */
    private long timeGap = 60 * 1000;

    /**
     * 请求参数，有效期校验（默认时间位 1min）
     * TODO 上线前，需要配置为 true
     */
    private boolean paramTimeCheck = false;

    /**
     * 为了测试环境方便，真实场景，还是需要动态生成 AES 密钥 和 AES IV 的
     * TODO 上线前，需要配置为 false
     */
    private boolean fixedAes = true;

}
